﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Janus.Windows.GridEX;

namespace Janus.NorthwindDemo2007
{
    public partial class CategoriesGridEXView : Janus.NorthwindDemo2007.GridEXView
    {
        public CategoriesGridEXView()
        {
            InitializeComponent();
        }
        protected override void OnFolderViewChanged()
        {
            base.OnFolderViewChanged();
            GridEXLayout layout = this.GridEX.FindLayout(this.FolderView.LayoutName);
            layout.SetDataBinding(this.DataSource, "Categories");

            this.GridEX.CurrentLayout = layout;
            //this.FillCountriesValueList();
            //We need to call Refetch method if valuelist or dropdowns are populated
            //after the datasource in the grid is populated
            this.GridEX.Refetch();

            this.EnableCommands();
        }
        public override void Edit()
        {
            foreach (GridEXSelectedItem item in this.GridEX.SelectedItems)
            {
                if (item.RowType == RowType.Record)
                {
                    CategoryDataForm custDialog = new CategoryDataForm();
                    custDialog.Edit(((DataRowView)(item.GetRow().DataRow)).Row);
                }
            }
        }
    }
}
